package com.itc.system.feign;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itc.system.api.domain.SysDept;
import com.itc.system.api.domain.SysUser;
import com.itc.system.api.domain.dto.SysDeptCheckDto;
import com.itc.system.service.SysDeptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author zhangyh
 */
@Api(tags = "调度服务Feign远程调用客户端")
@RestController
@RequestMapping("/systemFeign")
public class SystemClient {

    @Autowired
    public SysDeptService sysDeptService;

    /**
     * BI用户部门信息校验
     */
    @PostMapping(value = "/bi/dept/check")
    @ApiOperation(value = "BI用户部门信息校验")
    public Boolean biDeptCheck(@RequestBody SysDeptCheckDto dto){
        return sysDeptService.biDeptCheck(dto);
    }

    /**
     * 根据部门id获取部门树型信息
     */
    @GetMapping(value = "/get/deptTreeById")
    @ApiOperation(value = "根据部门id获取部门树型信息")
    public List<SysDept> getSysDeptById(@RequestParam("deptId") String deptId){
        return sysDeptService.getSysDeptById(deptId);
    }

    /**
     *   根据deptId获取部门信息
     */
    @GetMapping(value = "/get/deptById")
    @ApiOperation(value = "根据userid获取部门信息")
    public SysDept getDeptById(@RequestParam("deptId") Long deptId){
        return sysDeptService.getDeptById(deptId);
    }

    /**
     * 根据用户userId获取用户信息
     */
    @GetMapping(value = "/getDept/byUserId")
    @ApiOperation(value = "根据用户userid获取部门信息")
    public SysUser getUserById(@RequestParam("userId") Long userId){
       return sysDeptService.getUserById(userId);
    }

    /**
     *   根据deptChildIds获取多个席位信息
     */
    @GetMapping(value = "/get/deptChildByIds")
    @ApiOperation(value = "根据deptChildIds获取多个席位信息")
    public List<SysDept> getDeptChildByUserIds(@RequestParam("deptChildIds") String deptChildIds){
        return sysDeptService.getDeptChildByUserIds(deptChildIds);
    }

}
